#!/usr/local/bin/lua
--------------------------------------------------------------------------------
--
-- yourspace.lua
-- For now, just a sampling of what little Lua I know.
--
--------------------------------------------------------------------------------
secretword = "llama" -- the secret word


io.write ("Hello! What's your name? ") -- start things off with a greeting
name = io.read ("*l") -- read the next line

if name == "David" then
  print ("Hello, David! Your Lua program is running fine. ;]") -- just for me ;]
else
  print ("Hello " .. name .. "!") -- all others
  io.write ("What is the secret word? ")
  guess = io.read ("*l")
  while guess ~= secretword do
    io.write ("Wrong, try again. What is the secret word? ")
    guess = io.read ("*l")
  end
  print ("Correct!")
end

--------------------------------------------------------------------------------
-- That's all! Lua is turning out to be easy, and LOTS of fun ;]
-- This example program reminds me a lot of the code I used to write on the old
-- TRS-80 Model 100 in BASIC ;]
--------------------------------------------------------------------------------
